public class Demo2 {
    public static int[] getArrayMax(int[] arr) {
        int[] arrmax = new int[1];
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        arrmax[0] = max;
        return arrmax;
    }

    public static void main(String[] args) {
        int[] arr = new int[]{2, 9, 59, 3, 4};
        int[] arr1 = new int[]{55, 2, 4, 9, 6};
        int[] max1 = getArrayMax(arr);
        int[] max2 = getArrayMax(arr1);
        System.out.println(max1[0]);
        System.out.println(max2[0]);
    }
}
